﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Xsl;
using System.Xml.XPath;
using System.Xml;

namespace XmlDSigEx
{
    class XPathHereFunction:IXsltContextFunction
    {
        private XmlElement _element;

        internal XPathHereFunction(XmlElement element)
        {
            _element = element;
        }

        #region IXsltContextFunction Members

        public System.Xml.XPath.XPathResultType[] ArgTypes
        {
            get { return null; } 
        }

        public object Invoke(XsltContext xsltContext, object[] args, System.Xml.XPath.XPathNavigator docContext)
        {
            return _element.CreateNavigator().Select(".");
        }
        

        public int Maxargs
        {
            get { return 0; }
        }

        public int Minargs
        {
            get { return 0; }
        }

        public System.Xml.XPath.XPathResultType ReturnType
        {
            get { return XPathResultType.NodeSet; }
        }

        #endregion
    }
}
